﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;
using System.Xml.Serialization;
using cz.uhul.DSMLv2;
using cz.uhul.DSMLv2.Server.Sql;


namespace cz.uhul.services.DSMLv2
{
  /// <summary>
  /// Summary description for LDConnection
  /// </summary>
  //[WebService(Namespace = "https://eagri.cz/ssl/basic-app/uhul/mtest/LDS")]
  [WebService(Namespace = "http://eagri.cz/public/app/uhul/wtest/LDS")]
  [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  [System.ComponentModel.ToolboxItem(false)]
  // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
  // [System.Web.Script.Services.ScriptService]
  public class LDConnection : System.Web.Services.WebService
  {





    [SoapDocumentMethod(ParameterStyle = SoapParameterStyle.Bare
      //, RequestElementName = "batchRequest"
      //, ResponseElementName = "batchResponse"
      )
    ]
    [return: XmlElement("batchResponse")]
    [WebMethod]
    public XmlDocument Process(XmlDocument batchRequest1)
    {

      LdRequestDocument rd;

      try
      {
        rd = LdRequestDocument.Parse(batchRequest1);
      }
      catch (Exception e)
      {
        throw new SoapException(e.Message, SoapException.ClientFaultCode);
      }

      LdResponseDocument response = LdRequestServerExtension.ProcessBatch(rd);

      return response.ToXml();

    }



  }

}
